#include <bits/stdc++.h>
using namespace std;
#define int long long
int a[100005], ans;
bool g[100005];

signed main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);//1 1 2 2 3
    for(int i = 1; i <= n; i++)
    {
        sort(a + 1, a + n + 1);
        while(a[i] == 0) i++;
        if(g[i + 1] == 0 && a[i + 1] > a[i])
        {
            a[i] = 0;
            g[i] = 0;
            g[i + 1] = 1;
        }
        if(g[i + 1] == 0 && a[i] == a[i + 1])
        {
            g[i + 1] = 1;
        }
    }
    for(int i = 1; i <= n; i++)
    {
        if(g[i] == 1) ans++;
    }
    cout << ans << "\n";
    return 0;
}
